package com.csii.adhoc.dataunits.mapper;


import com.csii.adhoc.dataunits.UnitBase.UnitBasePo;
import com.csii.adhoc.dataunits.UnitBase.UnitBaseVo;
import org.apache.ibatis.annotations.Insert;

import java.util.List;

public interface UnitBaseMapper {
    int deleteUnitBaseByPrimaryKey(String unitId);

    int insertOneUnitBase(UnitBasePo record);

    int insertSelective(UnitBasePo record);

    UnitBasePo selectByPrimaryKey(String unitId);

    int updateUnitBaseByPrimaryKey(UnitBasePo record);

    //相同功能的注解实现,因xml方式在我的电脑上老是报错,故暂时使用注解保证开发进度
    @Insert(" insert into T_UNIT_BASE (UNIT_ID, UNIT_NAME, UNIT_TYPE, " +
            "      MODEL_ID, TABLE_TYPE, PIC_TYPE, " +
            "      PIC_CLASS, HAXIS, VAXIS, " +
            "      LENGTH, WIDTH, SEQNO, " +
            "      CREATED_BY, CREATED_DT, UPDATED_BY, " +
            "      UPDATED_DT,BOARD_ID)" +
            "    values (#{unitId,jdbcType=VARCHAR}, #{unitName,jdbcType=VARCHAR}, #{unitType,jdbcType=VARCHAR}, " +
            "      #{modelId,jdbcType=VARCHAR}, #{tableType,jdbcType=VARCHAR}, #{picType,jdbcType=VARCHAR}, " +
            "      #{picClass,jdbcType=VARCHAR}, #{haxis,jdbcType=NUMERIC}, #{vaxis,jdbcType=NUMERIC}, " +
            "      #{length,jdbcType=NUMERIC}, #{width,jdbcType=NUMERIC}, #{seqno,jdbcType=NUMERIC}, " +
            "      #{createdBy,jdbcType=VARCHAR}, #{createdDt,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, " +
            "      #{updatedDt,jdbcType=VARCHAR},#{boardId,jdbcType=VARCHAR})")
    int insertOneUnitBase2(UnitBasePo record);

    int updateByPrimaryKey(UnitBasePo record);

    List<UnitBaseVo> selectByDashboardId(String boardId);

    Integer getUnitType(String unitId);


    String selectModelIdByUnitId(String unitId);

    void updateModelIdByUnitId(UnitBasePo unitBasePo);
}